-
Notifications
You must be signed in to change notification settings - Fork 5.3k
JIT: Make GS cookie phase run on LIR and move it after async phase #122973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jakobbotsch
wants to merge
8
commits into
dotnet:main
Choose a base branch
from
jakobbotsch:fix-122954
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+424
−362
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… transformation Functions with GS cookie checks may furthermore shadow parameters to make sure that the GS cookie ends up above all parameters on the stack. This is done by creating a copy of parameters used like a pointer and redirection all uses to act on the shadow. IR is inserted in the beginning of the function to copy the parameters to their shadows. For async this introduces a problem when it comes to implicit byrefs. The shadowing ceremony introduces a pointer to a local (the storage area in the caller) and that pointer remains live across suspension points, resulting in illegal IR. Ideally we would move the shadowing pass to run after the async transformation, but this requires rewriting the analysis from HIR to LIR. This change instead fixes the issue by keeping the analysis where it is, but by delaying the rewrite of the IR until after the async transformation (for async functions only).
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
jakobbotsch
commented
Jan 7, 2026
jakobbotsch
commented
Jan 7, 2026
Member
Author
|
I think I will spend a bit more time and move the entire phase to unconditionally run on LIR. The current approach means that we are barely testing the LIR version of this. |
jakobbotsch
commented
Jan 13, 2026
Member
Author
|
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Functions with GS cookie checks may furthermore shadow parameters to make sure that the GS cookie ends up above all parameters on the stack. This is done by creating a copy of parameters used like a pointer and redirecting all uses to act on the shadow. IR is inserted in the beginning of the function to copy the parameters to their shadows.
For async this introduces a problem when it comes to implicit byrefs. The shadowing ceremony introduces a pointer to a local (the storage area in the caller) and that pointer remains live across suspension points, resulting in illegal IR.
This PR moves the GS phase so that it runs after the async transformation. To do so rewrite the analysis to run on LIR and the IR insertion/rewriting to be compatible with LIR.
Fix #122954